package cn.wolfcode.luowowo.community.service.impl;

import cn.wolfcode.luowowo.community.domain.Question;
import cn.wolfcode.luowowo.community.mapper.QuestionMapper;
import cn.wolfcode.luowowo.community.service.IQuestionService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

@Service
public class QuestionServiceImpl implements IQuestionService {

    @Autowired
    private QuestionMapper questionMapper;
    @Override
    public Long save(Question question) {
        question.setPublish_time(new Date());
        questionMapper.insert(question);
        Long id = question.getId();
        return id;
    }

    @Override
    public Question getQuestionDetailById(Long id) {

        return questionMapper.selectByPrimaryKey(id);

    }

    @Override
    public List<Long> getAllQuestionId() {

        return questionMapper.selectAllQuestionId();

    }
}
